<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
<html lang="de">
    <head>
        <title>Hyphenator.js &ndash; Test 46</title>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        <style type="text/css">
            body {
                width:50%;
                margin-left:25%;
                margin-right:25%;
            }
            #test {
            	background-color: #ffd6d6;
            }
            #ref1 {
            	display: none;
            }
            #ref2 {
            	background-color: #d6ffd6;
            }
        </style>
        <script src="files/jquery.js" type="text/javascript"></script>
        <script src="../Hyphenator.js" type="text/javascript"></script>
        <script src="../patterns/de.js" type="text/javascript"></script>
        <script type="text/javascript">
			var t, r1, r2, desc, msg = {}, r = true;
			
			Hyphenator.config({
				hyphenchar: '|',
				selectorfunction: function () {
					return $('#test').get();
				}
			});
			
			if (window != parent) {
				Hyphenator.config({
					'onhyphenationdonecallback': function () {
						desc = document.getElementById('desc').innerHTML;
						t = document.getElementById('test').innerHTML;
						r1 = document.getElementById('ref1').innerHTML;
						r = r && (t == r1);
						$('#btn').click();
					}
				});
			}
			Hyphenator.run();
			
			function cb () {
				if (window != parent) {
					Hyphenator.config({
						'onhyphenationdonecallback': function () {
							t = document.getElementById('test').innerHTML;
							r2 = document.getElementById('ref2').innerHTML;
							r = r && (t == r2);
							msg.desc = desc;
							msg.index = 46;
							msg.result = r ? 'passed' : 'failed';
							parent.postMessage(JSON.stringify(msg), window.location.href);
						}
					});
				}
				Hyphenator.run();
			}
            function insert()  {
 			    $("#test").load("files/test44inc.html", cb);
			}
			
        </script>
    </head>
    <body>
		<p><a href="index.html">&lt;&lt;- index</a> | <a href="test45.html">&lt;- Prev</a> | <a href="test47.html">Next -&gt;</a></p>
        <h1>Test 46</h1>
        <p id="desc">Hyphenating content that has been loaded by AJAX. This time, de.js is loaded manually</p>
		<form method="post" action="#">
		<input id="btn" type="button" value="load text…" onclick="insert()">
		</form>
        <p id="test">Silbentrennung</p>
        <p id="ref1">Sil|ben|tren|nung</p>
        <p id="ref2">Das eng|li|sche Wort <span lang="en">&ldquo;Hy|phen|ation&rdquo;</span> lässt sich nicht un|be|dingt wört|lich mit «Sil|ben|tren|nung» über|set|zen.</p>
    </body>
</html>